what is the formula of Lagrange's theorem